package com.relytosoft.mizar.media.analyze.services.service.system.impl;


import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.relytosoft.dubhe.common.core.base.page.PageQuery;
import com.relytosoft.mizar.media.analyze.api.entity.system.AyAlarm;
import com.relytosoft.mizar.media.analyze.services.mapper.system.AyAlarmMapper;
import com.relytosoft.mizar.media.analyze.services.service.system.AyAlarmService;
import org.springframework.stereotype.Service;

/**
 * @author lj
 * @date 2022/5/24 17:29
 */
@Service
public class AyAlarmServiceImpl extends ServiceImpl<AyAlarmMapper, AyAlarm> implements AyAlarmService {

    @Override
    public IPage<AyAlarm> selectAyAlarmPageList(PageQuery pageQuery, AyAlarm ayAlarm) {
        if (StrUtil.isBlank(pageQuery.getOrderByColumn())) {
            pageQuery.setOrderByColumn("id");
            pageQuery.setIsAsc("desc");
        }
        return baseMapper.selectPageAlarmList(pageQuery.build(), ayAlarm);
    }

    @Override
    public boolean addAyAlarm(AyAlarm ayAlarm) {
        return this.save(ayAlarm);
    }
}
